package com.tianzhu.domain;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


/**
 * The persistent class for the ACL_OBJECT_IDENTITY database table.
 * 
 */
@Entity
@Table(name="ACL_OBJECT_IDENTITY")
@NamedQuery(name="AclObjectIdentity.findAll", query="SELECT a FROM AclObjectIdentity a")
public class AclObjectIdentity implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="ACL_OBJECT_IDENTITY_ID_GENERATOR", sequenceName="ACL_OBJECT_IDENTITY_S")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ACL_OBJECT_IDENTITY_ID_GENERATOR")
	@Column(unique=true, nullable=false, precision=38)
	private Long id;

	@Column(name="ENTRIES_INHERITING", nullable=false, precision=1)
	private Integer entriesInheriting;

	@Column(name="OBJECT_ID_IDENTITY", nullable=false, precision=38)
	private long objectIdIdentity;

	//bi-directional many-to-one association to AclEntry
	@OneToMany(mappedBy="aclObjectIdentityBean")
	private List<AclEntry> aclEntries;

	//bi-directional many-to-one association to AclClass
	@ManyToOne
	@JoinColumn(name="OBJECT_ID_CLASS", nullable=false)
	private AclClass aclClass;

	//bi-directional many-to-one association to AclObjectIdentity
	@ManyToOne
	@JoinColumn(name="PARENT_OBJECT")
	private AclObjectIdentity aclObjectIdentity;

	//bi-directional many-to-one association to AclObjectIdentity
	@OneToMany(mappedBy="aclObjectIdentity")
	private List<AclObjectIdentity> aclObjectIdentities;

	//bi-directional many-to-one association to AclSid
	@ManyToOne
	@JoinColumn(name="OWNER_SID")
	private AclSid aclSid;

	public AclObjectIdentity() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getEntriesInheriting() {
		return this.entriesInheriting;
	}

	public void setEntriesInheriting(Integer entriesInheriting) {
		this.entriesInheriting = entriesInheriting;
	}

	public long getObjectIdIdentity() {
		return this.objectIdIdentity;
	}

	public void setObjectIdIdentity(long objectIdIdentity) {
		this.objectIdIdentity = objectIdIdentity;
	}

	public List<AclEntry> getAclEntries() {
		return this.aclEntries;
	}

	public void setAclEntries(List<AclEntry> aclEntries) {
		this.aclEntries = aclEntries;
	}

	public AclEntry addAclEntry(AclEntry aclEntry) {
		getAclEntries().add(aclEntry);
		aclEntry.setAclObjectIdentityBean(this);

		return aclEntry;
	}

	public AclEntry removeAclEntry(AclEntry aclEntry) {
		getAclEntries().remove(aclEntry);
		aclEntry.setAclObjectIdentityBean(null);

		return aclEntry;
	}

	public AclClass getAclClass() {
		return this.aclClass;
	}

	public void setAclClass(AclClass aclClass) {
		this.aclClass = aclClass;
	}

	public AclObjectIdentity getAclObjectIdentity() {
		return this.aclObjectIdentity;
	}

	public void setAclObjectIdentity(AclObjectIdentity aclObjectIdentity) {
		this.aclObjectIdentity = aclObjectIdentity;
	}

	public List<AclObjectIdentity> getAclObjectIdentities() {
		return this.aclObjectIdentities;
	}

	public void setAclObjectIdentities(List<AclObjectIdentity> aclObjectIdentities) {
		this.aclObjectIdentities = aclObjectIdentities;
	}

	public AclObjectIdentity addAclObjectIdentity(AclObjectIdentity aclObjectIdentity) {
		getAclObjectIdentities().add(aclObjectIdentity);
		aclObjectIdentity.setAclObjectIdentity(this);

		return aclObjectIdentity;
	}

	public AclObjectIdentity removeAclObjectIdentity(AclObjectIdentity aclObjectIdentity) {
		getAclObjectIdentities().remove(aclObjectIdentity);
		aclObjectIdentity.setAclObjectIdentity(null);

		return aclObjectIdentity;
	}

	public AclSid getAclSid() {
		return this.aclSid;
	}

	public void setAclSid(AclSid aclSid) {
		this.aclSid = aclSid;
	}

}